﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace ClassLibrary1
{
    public partial class 主界面 : Form
    {
        int panelWidth = 202;
        bool iscCollspased;
                    
        public 主界面()
        {
            InitializeComponent();
            iscCollspased = false;
            realtime.Start();
        }

        private void a (Control nameaa)
        {
          
            nameaa.Dock = DockStyle.Fill;
            content.Controls.Clear();
            content.Controls.Add(nameaa);
        }


        private void label1_Click(object sender, EventArgs e)
        {
            pictureBox2.BackColor = Color.Yellow;
        }

        private void label4_Click(object sender, EventArgs e)
        {
            pictureBox2.BackColor = Color.White;
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            // this.Close();//关闭当前窗口
            //  this.Dispose();//释放资源
            //  Application.Exit();//消息终止
            System.Environment.Exit(0);//完全释放
        }

        private void 主界面_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            Moveguangbiao(button2);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (iscCollspased)
            {
                panelLeft.Width = panelLeft.Width + 80;
                if (panelLeft.Width >= panelWidth)
                {
                    timer1.Stop();
                    iscCollspased = false;
                    this.Refresh();
                }
            }
            else
            {
                panelLeft.Width = panelLeft.Width - 80;
                if (panelLeft.Width <= 56)
                {
                    timer1.Stop();
                    iscCollspased = true;
                    this.Refresh();
                }
            }
        }

        private void pictureBox1_Click_2(object sender, EventArgs e)
        {
            timer1.Start();

        }

        private void realtime_Tick(object sender, EventArgs e)
        {
            DateTime realtime = DateTime.Now;
            labrealtime.Text = realtime.ToString("hh:mm:ss");
        }
        #region panel的光标移动(guangbiaopanel)

        private void Moveguangbiao(Control controlName)
        {
            guangbiao.Top = controlName.Top;
            guangbiao.Height = controlName.Height;
        }
        #endregion

        private void zhuye_Click(object sender, EventArgs e)
        {
            Moveguangbiao(zhuye);
        }

        private void tushuguanli_Click(object sender, EventArgs e)
        {
            Moveguangbiao(tushuguanli);
            UserControl mb = new UserControl();
            mb.Dock = DockStyle.Fill;
                       
        }

        private void huanshu_Click(object sender, EventArgs e)
        {

            Moveguangbiao(huanshu);
        }

        private void xujie_Click(object sender, EventArgs e)
        {
            Moveguangbiao(xujie);
        }

        private void tongji_Click(object sender, EventArgs e)
        {

            Moveguangbiao(tongji);
        }

        private void shezhi_Click(object sender, EventArgs e)
        {

            Moveguangbiao(shezhi );
        }

        private void yonghuguanli_Click(object sender, EventArgs e)
        {

            Moveguangbiao(yonghuguanli);
            aboutus us = new aboutus();
            us.ShowDialog();
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
        }
    }
}